﻿using Core.Interfaces;

namespace Core.Base
{
    /// <summary>
    /// UI面板的基类
    /// </summary>
    public class BasePanel<T> : CancelTokenExtensionMono where T : class
    {
        public static T Ins { get; private set; }

        public override void OnInit()
        {
            base.OnInit();
            Ins = this as T;

            gameObject.SetActive(true);
            transform.SetHide();
        }


        public virtual void OnOpen()
        {
            transform.SetShow();
        }

        public virtual void OnClose()
        {
            transform.SetHide();
        }

        public virtual void SetShowState(bool isShow)
        {
            transform.SetShowState(isShow);
        }

        public override void OnDestroy()
        {
            base.OnDestroy();
        }
    }
}